<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>strrindex</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="strlowerk.html" title="strlowerk" />
    <link rel="next" href="strrindexk.html" title="strrindexk" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">strrindex</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="strlowerk.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="strrindexk.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="strrindex"></a>
      <div class="titlepage"></div>
      <a id="Indexstrrindex" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">strrindex</span>
        </h2>
        <p>strrindex — 
      Return the position of the last occurence of a string in another string
          </p>
      </div>
      <div class="refsect1">
        <a id="idp153798480"></a>
        <h2>Description</h2>
        <p>
      Return the position of the last occurence of S2 in S1, or -1 if not
      found. If S2 is empty, the length of S1 is returned. strrindex runs
      at init time only.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp153809936"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ipos <span class="command"><strong>strrindex</strong></span> S1, S2</pre>
      </div>
      <div class="refsect1">
        <a id="idp153812032"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the strrindex opcode. It uses the file <a class="ulink" href="examples/strrindex.csd" target="_top"><em class="citetitle">strrindex.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp153866432"></a>
          <p class="title">
            <strong>Example 880. Example of the strrindex opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-n    <span class="comment">;;;no sound output</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>
<span class="comment">;example by Joachim Heintz</span>

  <span class="oblock">opcode</span> FilNam, S, S
<span class="comment">;returns the name of a file path</span>
Spath  <span class="opc">xin</span>
ipos   <span class="opc">strrindex</span> Spath, "<span class="op">/</span>"	<span class="comment">;look for the rightmost '/'</span>
Snam   <span class="opc">strsub</span>    Spath, ipos<span class="op">+</span>1	<span class="comment">;extract the substring </span>
       <span class="opc">xout</span>      Snam
  <span class="oblock">endop</span>
  
<span class="oblock">instr</span> name
       <span class="opc">prints</span>    "Printing name<span class="op">:</span>\n"
Snam   FilNam    "<span class="op">/</span>my<span class="op">/</span>dir<span class="op">/</span>my<span class="op">/</span>file.WAV"
       <span class="opc">puts</span>      Snam, 1  

<span class="oblock">endin</span> 
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span> "name" 0 0
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp153870288"></a>
        <h2>See also</h2>
        <p>
          <a class="link" href="strrindexk.html" title="strrindexk">
            <em class="citetitle">strrindexk</em>
          </a>
        </p>
      </div>
      <div class="refsect1">
        <a id="idp153872080"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Istvan Varga</td>
          </tr>
          <tr>
            <td>2006</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in version 5.02</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="strlowerk.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="strrindexk.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">strlowerk </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> strrindexk</td>
        </tr>
      </table>
    </div>
  </body>
</html>
